package com.spic.system.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spic.system.mapper.UserAllDirtyMapper;
import com.spic.system.domain.UserAllDirty;
import com.spic.system.service.IUserAllDirtyService;

/**
 * 人员脏数据Service业务层处理
 * 
 * @author 赵祥
 * @date 2022-11-24
 */
@Service
public class UserAllDirtyServiceImpl implements IUserAllDirtyService 
{
    @Autowired
    private UserAllDirtyMapper userAllDirtyMapper;

    /**
     * 查询人员脏数据
     * 
     * @param personnelCode 人员脏数据主键
     * @return 人员脏数据
     */
    @Override
    public UserAllDirty selectUserAllDirtyByPersonnelCode(String personnelCode)
    {

        return userAllDirtyMapper.selectUserAllDirtyByPersonnelCode(personnelCode);
    }

    /**
     * 查询人员脏数据列表
     * 
     * @param userAllDirty 人员脏数据
     * @return 人员脏数据
     */
    @Override
    public List<UserAllDirty> selectUserAllDirtyList(UserAllDirty userAllDirty)
    {
        return userAllDirtyMapper.selectUserAllDirtyList(userAllDirty);
    }

    /**
     * 新增人员脏数据
     * 
     * @param userAllDirty 人员脏数据
     * @return 结果
     */
    @Override
    public int insertUserAllDirty(UserAllDirty userAllDirty)
    {
        return userAllDirtyMapper.insertUserAllDirty(userAllDirty);
    }

    /**
     * 修改人员脏数据
     * 
     * @param userAllDirty 人员脏数据
     * @return 结果
     */
    @Override
    public int updateUserAllDirty(UserAllDirty userAllDirty)
    {
        return userAllDirtyMapper.updateUserAllDirty(userAllDirty);
    }

    /**
     * 批量删除人员脏数据
     * 
     * @param personnelCodes 需要删除的人员脏数据主键
     * @return 结果
     */
    @Override
    public int deleteUserAllDirtyByPersonnelCodes(String[] personnelCodes)
    {
        return userAllDirtyMapper.deleteUserAllDirtyByPersonnelCodes(personnelCodes);
    }

    /**
     * 删除人员脏数据信息
     * 
     * @param personnelCode 人员脏数据主键
     * @return 结果
     */
    @Override
    public int deleteUserAllDirtyByPersonnelCode(String personnelCode)
    {
        return userAllDirtyMapper.deleteUserAllDirtyByPersonnelCode(personnelCode);
    }

    @Override
    public Map<String, Integer> statistics() {
        Integer all = 0, allDirty = 0, incomplete = 0, incorrect = 0;
        all = userAllDirtyMapper.userAllCount();
        allDirty = userAllDirtyMapper.userAllDirtyCount();
        incomplete = userAllDirtyMapper.userAllDirtyIncompleteCount();
        incorrect = userAllDirtyMapper.userAllDirtyIncorrectCount();
        Map<String, Integer> map = new HashMap<>();
        map.put("all", all);
        map.put("allDirty", allDirty);
        map.put("incomplete", incomplete);
        map.put("incorrect", incorrect);
        return map;
    }
}
